// $Id$
// Licensed under Apache License Version 2.0
// See: http://www.apache.org/licenses/LICENSE-2.0.html
package de.servicezombie.tcmdb.rest;

import java.util.HashMap;
import java.util.Map;

public abstract class RestPathUtils {
	private static final String NEW_RECORD_REQUESTED = "new";
	
	private static Map<String, DocumentType> documentTypes = new HashMap<String, DocumentType>();
	
	static {
		documentTypes.put("all", DocumentType.ALL);
		documentTypes.put("active", DocumentType.ACTIVE);
		documentTypes.put("archived", DocumentType.ARCHIVED);
	}
	
	public static boolean isNewRecordRequested(String anyId) {
		return NEW_RECORD_REQUESTED.equals(anyId);
	}
	
	public static DocumentType toTypeEnum(String typeId) {
		DocumentType result = documentTypes.get(typeId);
		if(result == null) {
			result = DocumentType.UNKNOWN;					
		}
		return result;		
	}
}
